<include file="Admin:header" />
<script type="text/javascript">
 
  function checknode(obj)
  {
      var chk = $("input[type='checkbox']");
      var count = chk.length;
      var num = chk.index(obj);
      var level_top = level_bottom =  chk.eq(num).attr('level');
      for (var i=num; i>=0; i--)
      {
              var le = chk.eq(i).attr('level');
              if(eval(le) < eval(level_top)) 
              {
                  chk.eq(i).attr("checked",true);
                  var level_top = level_top-1;
              }
      }
      for (var j=num+1; j<count; j++)
      {
              var le = chk.eq(j).attr('level');
              if(chk.eq(num).attr("checked")=="checked" || chk.eq(num).attr("checked")==true) {
                  if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true);
                  else if(eval(le) == eval(level_bottom)) break;
              }else {
                  if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
                  else if(eval(le) == eval(level_bottom)) break;
              }
      }
  }

</script>
<style>.mainnav_title{display:none;}</style>
<form id="myform" name="myform" action="{:U('Access/insert')}" method="post">
<input type="hidden" id="rid" name="rid" value="{$rid}" />
<div class="pad-lr-10">


<div class="table-list">
    <table width="100%" cellspacing="0"  id="dnd-example"> 
	<tbody>
	<volist name="node" id="r" key="k">
	<if condition="$r[pid]==0">
		<tr>
		<td style='padding-left:10px;'><input type='checkbox' name='nid[{$r.id}]' value='{$r.id}'  level='{$r.level}' {$r.selected}  onclick='javascript:checknode(this);' /> {$r.title}</td>
		</tr>
			<volist name="node" id="rr" key="k">
			<if condition="$rr[pid]==$r[id]">
			<tr>
			<td style='padding-left:10px;'>{%tree_2}<input type='checkbox' name='nid[{$rr.id}]' value='{$rr.id}'  level='{$rr.level}' {$rr.selected}  onclick='javascript:checknode(this);' /> {$rr.title}</td>
			</tr>	
					<tr>
						<td style='padding-left:30px;'>{%tree_3}
						<volist name="node" id="rrr" key="k">
						<if condition="$rrr[pid]==$rr[id]">
						<input type='checkbox' name='nid[{$rrr.id}]' value='{$rrr.id}'  level='{$rrr.level}' {$rrr.selected}  onclick='javascript:checknode(this);' /> {$rrr.title} &nbsp;
						</if>
						</volist>
						</td>
					</tr>
			</if>
			</volist>
	</if>
	</volist>

	</tbody>
    </table>
</div>
</div><input type="submit" style="display:none;" class="button"  value="{:L('dosubmit')}" />
</form></div>
 